package com.siemens.industrial.model.admin;

import org.springframework.jdbc.core.RowMapper;

/**
 * Created by qupen on 2016/9/18.
 */
public class Metadata {

    public static final String METAKEY_IDLE="IDLE";
    public static final String METAKEY_TYPE="FaultType";
    public static final String METAKEY_NUMBER="MachineNumber";//元数据的key 作为三种类型模板的区分

    public static final String METADATA_MACHINETYPE_KEY="MachineType";
    public static final String METADATA_MACHINENUMBER_KEY="MachineNumber";
    public static final String METADATA_OOEFORMULA_KEY="OOEFormula";
    public static final String METADATA_MACHINEIMG_KEY="MachineImg";//机床类型

    public static final String METADATA_IDLEREASON_KEY="IDLEReason";
    public static final String METADATA_IDLEDESCRIPTION_KEY="IDLEDescription";//idle

    public static final String METADATA_TYPEREASON_KEY="FaultTypeReason";
    public static final String METADATA_TYPEDESCRIPTION_KEY="FaultTypeDescription";//故障原因

    private String metaId;
    private String metaKey;
    private String metaDefinition;


    private static final RowMapper<Metadata> rowMapper = (resultSet, i) -> {
        Metadata metadata = new Metadata();
        metadata.setMetaId(resultSet.getString("meta_id"));
        metadata.setMetaKey(resultSet.getString("meta_key"));
        metadata.setMetaDefinition(resultSet.getString("meta_definition"));
        return metadata;
    };

    public static RowMapper<Metadata> getRowMapper() {
        return rowMapper;
    }

    public String getMetaId() {
        return metaId;
    }

    public void setMetaId(String metaId) {
        this.metaId = metaId;
    }

    public String getMetaKey() {
        return metaKey;
    }

    public void setMetaKey(String metaKey) {
        this.metaKey = metaKey;
    }

    public String getMetaDefinition() {
        return metaDefinition;
    }

    public void setMetaDefinition(String metaDefinition) {
        this.metaDefinition = metaDefinition;
    }
}
